<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="949.54">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #001fe8}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #9d281b}
p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #606060}
p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #0024b5}
span.s1 {font: 18.0px Helvetica}
span.s2 {color: #000000}
span.s3 {text-decoration: underline}
span.s4 {color: #2c4796}
span.s5 {color: #0024b5}
span.s6 {color: #9d281b}
span.s7 {color: #606060}
span.Apple-tab-span {white-space:pre}
</style>
</head>
<body>
<p class="p1"><span class="s1"><b>RedDPCMdecode</b></span><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>differential pulse-code modulation</b></p>
<p class="p2"><br></p>
<p class="p2"><br></p>
<p class="p1">very simple ugen to decode dpcm encoded signals.<span class="Apple-converted-space">  </span>can also be (mis)used for other purposes.</p>
<p class="p2"><br></p>
<p class="p3"><span class="s2">see also: <a href="RedDPCMencode.html"><span class="s3">RedDPCMencode</span></a></span></p>
<p class="p2"><br></p>
<p class="p1"><span class="s4"><b><span class="Apple-tab-span">	</span></b></span><b>*ar(in)</b></p>
<p class="p1"><b><span class="Apple-tab-span">	</span>*kr(in)</b></p>
<p class="p1"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>in - input signal</p>
<p class="p1"><span class="Apple-tab-span">	</span><b>dpcm(in)</b></p>
<p class="p1"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>language side</p>
<p class="p2"><br></p>
<p class="p4"><br></p>
<p class="p5">//--</p>
<p class="p6">s.boot</p>
<p class="p7"><span class="s2">b= </span><span class="s5">Buffer</span><span class="s2">.read(s, </span>"sounds/a11wlk01.wav"<span class="s2">)</span></p>
<p class="p6">a= {<span class="s5">RedDPCMdecode</span>.ar(<span class="s5">PlayBuf</span>.ar(1, b, loop:1)).dup}.play<span class="Apple-tab-span">	</span><span class="s6">//loud!</span></p>
<p class="p6">a.free</p>
<p class="p6">a= {<span class="s5">PlayBuf</span>.ar(1, b, loop:1).dup}.play</p>
<p class="p6">a.free</p>
<p class="p6">b.free</p>
<p class="p4"><br></p>
<p class="p4"><br></p>
<p class="p5">//--</p>
<p class="p6">a= {<span class="s5">RedDPCMdecode</span>.ar(<span class="s5">SoundIn</span>.ar([0, 1]))}.play</p>
<p class="p6">a.free</p>
<p class="p6">a= {<span class="s5">SoundIn</span>.ar([0, 1])}.play</p>
<p class="p6">a.free</p>
<p class="p4"><br></p>
<p class="p4"><br></p>
<p class="p5">//--language side</p>
<p class="p6">(</p>
<p class="p8"><span class="s2">a= </span>RedDPCMdecode<span class="s2">.new;</span></p>
<p class="p6">[0, 0, 1, 0.6, 0.49, 0, -1].do{<span class="s5">|x|</span> a.dpcm(x, 0).postln}; <span class="s7">""</span></p>
<p class="p6">)</p>
<p class="p4"><br></p>
<p class="p6">(</p>
<p class="p8"><span class="s2">a= </span>RedDPCMdecode<span class="s2">.new;</span></p>
<p class="p8"><span class="s2">b= </span>RedDPCMencode<span class="s2">.new;</span></p>
<p class="p6">[0, 0, 1, 0.6, 0.49, 0, -1].do{<span class="s5">|x|</span> b.dpcm(a.dpcm(x), 0).postln}; <span class="s7">""</span></p>
<p class="p6">)</p>
</body>
</html>
